<?php
	
	header('Content-type:text/html;charset=utf-8');
//	var_dump($_POST);
	
	$title = isset($_POST['title']) ? trim($_POST['title']) : '';
	$email = isset($_POST['email']) ? trim($_POST['email']) : '';
	$person = isset($_POST['person']) ? trim($_POST['person']) : '佚名';
	$message = isset($_POST['message']) ? trim($_POST['message']) : '';
	
	if(empty($title) || empty($message)){
		header('Refresh:3;url=index.html');//header前能不能有输出，Refresh不会阻止脚本的执行
		
		exit('标题和内容不能为空');
	}
	
	include_once 'mysql.php';
	
	$sql = "insert into news values(null,'{$title}','{$email}','{$person}','{$message}')";
	
	$insert_id = my_error($sql);
	
	header('Refresh:3;url=news.php');//header前能不能有输出，Refresh不会阻止脚本的执行
		
	echo $title . '增加成功';
?>